我正在尝试将migratordotnet用于现有数据库。我的数据库有大约 100 个表,我正在尝试生成初始迁移。
我试过使用
C:\migrations>Migrator.Console.exe SqlServer "Data Source=.\sqlexpress;Initial Catalog=my_database;Integrated Security = True;" MigracijeBaze.dll -dump InitialMigration.cs
不幸的是,生成的迁移具有 typeof(string) 的每一列。Int、DateTime、Decimal 列转换为字符串。例如,对于表 Godine
CREATE TABLE [dbo].[Godine](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FirmaID] [nvarchar](2) NOT NULL,
[Godina] [int] NOT NULL,
[BazaSifri] [nvarchar](50) NOT NULL,
[BazaPodataka] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_Godine] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
生成迁移
Database.AddTable("Godine",
new Column("ID", typeof(String)),
new Column("FirmaID", typeof(String)),
new Column("Godina", typeof(String)),
new Column("BazaSifri", typeof(String)),
new Column("BazaPodataka", typeof(String)),
);
难道我做错了什么?进行初始迁移的最佳实践是什么?