我有一个使用.mdf数据库的工作项目。 我删除了该数据库并进行了迁移,然后再次添加了它们。现在update-database命令什么也不做。
这是update-database命令的输出:
PM> Update-Database -v
Using StartUp project 'TrackingTest'.
Using NuGet project 'TrackingTest'.
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Target database is: '' (DataSource: (LocalDB)\MSSQLLocalDB, Provider: System.Data.SqlClient, Origin: Configuration).
No pending explicit migrations.
Applying automatic migration: 201811170653301_AutomaticMigration.
CREATE TABLE [dbo].[BatchToLists] (
[Id] [int] NOT NULL IDENTITY,
[InputBatch_Id] [int],
[OutputList_Id] [int],
CONSTRAINT [PK_dbo.BatchToLists] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[InputBatches] (
[Id] [int] NOT NULL IDENTITY,
[Producer_Id] [int],
[ProductType_Id] [int],
CONSTRAINT [PK_dbo.InputBatches] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[Producers] (
[Id] [int] NOT NULL IDENTITY,
[Title] [nvarchar](max),
CONSTRAINT [PK_dbo.Producers] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[OutputLists] (
[Id] [int] NOT NULL IDENTITY,
CONSTRAINT [PK_dbo.OutputLists] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[ProductTypes] (
[Id] [int] NOT NULL IDENTITY,
[Title] [nvarchar](max),
CONSTRAINT [PK_dbo.ProductTypes] PRIMARY KEY ([Id])
)
CREATE INDEX [IX_InputBatch_Id] ON [dbo].[BatchToLists]([InputBatch_Id])
CREATE INDEX [IX_OutputList_Id] ON [dbo].[BatchToLists]([OutputList_Id])
CREATE INDEX [IX_Producer_Id] ON [dbo].[InputBatches]([Producer_Id])
CREATE INDEX [IX_ProductType_Id] ON [dbo].[InputBatches]([ProductType_Id])
ALTER TABLE [dbo].[BatchToLists] ADD CONSTRAINT [FK_dbo.BatchToLists_dbo.InputBatches_InputBatch_Id] FOREIGN KEY ([InputBatch_Id]) REFERENCES [dbo].[InputBatches] ([Id])
ALTER TABLE [dbo].[BatchToLists] ADD CONSTRAINT [FK_dbo.BatchToLists_dbo.OutputLists_OutputList_Id] FOREIGN KEY ([OutputList_Id]) REFERENCES [dbo].[OutputLists] ([Id])
ALTER TABLE [dbo].[InputBatches] ADD CONSTRAINT [FK_dbo.InputBatches_dbo.Producers_Producer_Id] FOREIGN KEY ([Producer_Id]) REFERENCES [dbo].[Producers] ([Id])
ALTER TABLE [dbo].[InputBatches] ADD CONSTRAINT [FK_dbo.InputBatches_dbo.ProductTypes_ProductType_Id] FOREIGN KEY ([ProductType_Id]) REFERENCES [dbo].[ProductTypes] ([Id])
CREATE TABLE [dbo].[__MigrationHistory] (
[MigrationId] [nvarchar](150) NOT NULL,
[ContextKey] [nvarchar](300) NOT NULL,
[Model] [varbinary](max) NOT NULL,
[ProductVersion] [nvarchar](32) NOT NULL,
CONSTRAINT [PK_dbo.__MigrationHistory] PRIMARY KEY ([MigrationId], [ContextKey])
)
INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
VALUES (N'201811170653301_AutomaticMigration', N'TrackingTest.Migrations.Configuration', 0x1F8B0800000000000400ED5B4B6FE33610BE17E87F10746A8BAC95642F6D60EF62D79B1441370FC4CEA2B780916847A844B922152428FACB7AE84FEA5FE8E84DF1A58795ACB3087CB125CE701E1F39C3E1F8BF7FFE9DBE7F0803EB1EC7D48FC8CC3E98ECDB16266EE4F9643DB313B67AF3B3FDFEDDF7DF4D8FBDF0C1FA528E7B9B8E034A4267F61D639B23C7A1EE1D0E119D84BE1B47345AB1891B850EF222E7707FFF17E7E0C0C1C0C2065E9635BD4A08F3439CFD809FF388B878C312149C451E0E68F11CDE2C32AED6390A31DD2017CFEC658CDC3F40BA25A6CCB63E043E0219163858D91622246288818447D7142F581C91F562030F50B07CDC6018B74201C585E447F5F0AE4AEC1FA64A383561C9CA4D288BC29E0C0FDE16567144F241B6B52BAB81DD8EC1BEEC31D53AB3DDCCFE88987BB78C3EFBA9D5C4F98EE6419C8E6D5A77C2D1EC59FC9BBD0A090098F4B367CD938025319E119CB018057BD665721BF8EE6FF87119FD81C98C2441C04B0832C2BBC603787419471B1CB3C72BBC2AE43EF56CCB69D239226145C6D1E4EA9C12F6F6D0B6CE6172741BE00A009CEA0B16C5F8574C708C18F62E11633826290F9C99509AFD1CDDFBEB8C549C956C129699CCB6AE70900DA177FE2647276FCC1B7EE8491C855751D0741137E2661125B10B322F23E3B0258AD7987517F72261409BE3A1455C7EA85ADC7A84515C6E984ADCA953C3D60866DE7E1DB15C93BC42B9151BF0D34B5C1C2B9151BEBCC9BF30CA83427A5939BAC4833CA244CC2028D4A276044249F00A03CD5C4B9F05B89C0E822858C8B6CED0C3674CD6EC6E66C357F0B8FF80BDF24921C235F1217100221627B82FD852186D0F3671F3D1C37110D8F88DB023DC6A9257C00D59D92C7DD273716734AFE67E39EB3B7398618937DF6B56B930A8CF42FF4069E4FA996C4258A9856A6A7B4C3CAB7513CA2DCC6F636068409DBF019C8118337B7F3239902C69E25D45D39A379F0C35B9FF246ACFE969565F93ACEAE46CCB5C6B611BC710A3B45D26E8650DD9D6030DC245812EF2AA72E3510DA2C8AAB909F89835A241940BD78C63DD2A169749B1E50F58299A2D60D4C592EF20F38830E4C316DC344756BE5044AB6B8A8B80458BED53542465BAC04C861B6C87F5A6A5028D649326AB5A63AC62C51BA48553B91BA9D8D41B5C0B931A8E2A363C583B49536045234FF156E0C43956568E8B42DC386D362AA6035DE242A549C3A44E1F5625B239564D3F8B094853E70EF6D0952B64A37489157DA205A7537319182CD4121F9EC74C3C78CD66D245903E31645B3329A206C7B2B14CB7B6923ACBD3AD2F5350E91E56A455A6DC0CBA0791ED3154669F55ECA8CBDC4E5EE72EEBE18EA6203E3D439B0DE4EB5C81BC78622DF2EAF8FCCDA27FF138CC79382E55D4902B69AB99E0F881D658780B5383A4277E4CD927C4D02D4A4F0C732F94863522A5668B2FA7520443D97BE5CE5F12A5DF8B938EA6982D32A9CD78029A85708CCA94C4EA25265367F7142840B1E254378F822424BA9361EE6D6172514547D251409C68B74E566D8078B055F51B7E07A39A885FA44DEB703ED8A05522D5DF9C7AD2ED8CA9A32E0A093C83E2D1CE38840F63835DA28FD61D9C62227EC118CF83E996285732E90C740DF5B78FF56682A1DE81B834AB65A3E14676DF9FD3A4497367246562B27D3AF9A7E2A772546AA24A8021B21559DD40D97A8B04F98FE767D593539A9676AB9A6A478DC5ACB2372E74C7B9F664A931BC475AA47083F99436D41735A31190623E9BEE145C8C8A8F0A18FE60DB0130FCF0F100239F57077A8363343260E453FA4E01C6A8F8D680519FF1DBE3FFB8F1475D0CD82A04E52C478B42EAF2C24E01C5AC773B52A4428738A4CA90AA828750D898164586F67640A9EA900FB12D50E2DEF7D28AC3E291321C4ED20193C59FC13CF02127AB079C21E2AF0094F9ADAF7DB87F7028F415EE4E8F9F43A917288A349A46BFA6DF9EE1F6DA27E59E6FBA9F962EB7CD17D642A0E36692EE594E89871F66F65F19E59175FAFB4D8378CFBA88C1E347D6BEF5372F86F2425B9042D83DFB49D120EE2EC59086B86FC3E78D5CB89FAD39D26DFC2D6E82438428A99FC0E3EA62CF8BF577A32985DCA3D8BD43F10F217AF871247B692FED5F86C506754DBD44459F1E1A6334FB8CD1DC231EC3FB76280033F01B8E53B3A200722DCA62C8B6A46AD365EC13D7DFA040D441CE39BBE021356CC5527CF3096F30491D2DEBD865B6969A4FC55D00689B199EAEF1A9B70F5B30D168EC18DA253408153D3DB5252ECC97718AE9DA8A3CCF0C8D0E2D6062D164403BD68E40C378FFF1D5A1D15ACE7906680C6D861BA9F9EDEB4612DD2DCE6E041353F5667464A87B03E5C608D191DAE6BFB6DEBFBCD831B3BDDB085C9F6742A66E204377604B6FA06A26631F8CAE7BD0D83CA89A45DB2367E82D6C692D544D63EA78DAA2F750AF5136409EEB79BB1395DD88C62629193162AD76A79B0F7B8BAF0FC29A6B8D9D6E2A949788D8A5F0F5D57FFA6EC141DD816302BF472BA05C098700C5FD7D1EC224F5D7358BB4C44FB0DB084DD59853B28ACA482948540E114EDF6798210FE2D68798F92BE43278ED624AB33F0D7D414102438EC35BEC9D921C43A0320E6F83C6BF90D2486B9A3FEB776CCA3CBDD864FF141A430510D30715F005F998F88157C97DA228B36858A421BC2869A4BE64696963FD58713A8F48474685F9AACC6389C34D00CCE80559A07B3C44B66B8A3FE335721FCB0B0D3D93764734CD3EFDE4A3758C425AF0A8E9E12760D80B1FDEFD0F941AC6B945420000 , N'6.2.0-61023')
Running Seed method.
这是我在app.config文件中的连接字符串:
<add name="TrackingTest" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Warehouse.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
但是数据库中没有任何表!
更新
应用程序正常执行。然后表格应该在那里。但是 Server Explorer 不会显示它们!