주 메뉴 열기

wwiki β

바뀜

Asp.net core mvc

657 바이트 제거됨, 2022년 11월 14일 (월) 02:23
편집 요약 없음
==MySQL=====MySQL에서 마이그레이션 히스토리 테이블 생성===다음 에러메시지가 출력되는 경우에====에러메시지==== EFMigrationsHistory' doesn't exist ====쿼리문===다음 쿼리문을 사용하여 테이블을 생성한다.<syntaxhighlight lang="sql">
CREATE TABLE IF NOT EXISTS __EFMigrationsHistory (
  MigrationId varchar(150) NOT NULL,  ProductVersion varchar(32) NOT NULL,  CONSTRAINT PK___EFMigrationsHistory PRIMARY KEY (MigrationId) 
);
</syntaxhighlight>
===MySQL Identity 적용===
====에러메시지====
InvalidOperationException: No coercion operator is defined between types 'System.Int16' and 'System.Boolean'.
 
===PostgreSQL===
 
====nuget package====
Install-Package Npgsql.EntityFrameworkCore.PostgreSQL
 
====connection string====
"User ID=damienbod;Password=1234;Host=localhost;Port=5432;Database=damienbod;Pooling=true;"
 
===마이그레이션 명령===
====추가====
PM> Add-Migration InitialCreate
 
====복원====
PM> Update-Database 20161012160749_AddedOrderToCourse
 
====업데이트====
<syntaxhighlight lang="powershell">
Update-Database
</syntaxhighlight>
 
==== 마이그레이션 테이블 생성 ====
mysql의 경우에 필요한 경우가 있다.<syntaxhighlight lang="mysql">
CREATE TABLE `__EFMigrationsHistory` ( `MigrationId` nvarchar(150) NOT NULL, `ProductVersion` nvarchar(32) NOT NULL, PRIMARY KEY (`MigrationId`) );
</syntaxhighlight>
===모델===
WantedBy=multi-user.target
</syntaxhighlight><br />
[[분류:.net]]
[[분류:Asp.net]]
편집
2,431