1
0

AssetStore.migrations 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. :VERSION 1
  2. CREATE TABLE [assets] (
  3. [id] [varchar](36) NOT NULL,
  4. [name] [varchar](64) NOT NULL,
  5. [description] [varchar](64) NOT NULL,
  6. [assetType] [tinyint] NOT NULL,
  7. [local] [tinyint] NOT NULL,
  8. [temporary] [tinyint] NOT NULL,
  9. [data] [image] NOT NULL,
  10. PRIMARY KEY CLUSTERED
  11. (
  12. [id] ASC
  13. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  14. ) ON [PRIMARY]
  15. :VERSION 2
  16. BEGIN TRANSACTION
  17. CREATE TABLE Tmp_assets
  18. (
  19. id varchar(36) NOT NULL,
  20. name varchar(64) NOT NULL,
  21. description varchar(64) NOT NULL,
  22. assetType tinyint NOT NULL,
  23. local bit NOT NULL,
  24. temporary bit NOT NULL,
  25. data image NOT NULL
  26. ) ON [PRIMARY]
  27. TEXTIMAGE_ON [PRIMARY]
  28. IF EXISTS(SELECT * FROM assets)
  29. EXEC('INSERT INTO Tmp_assets (id, name, description, assetType, local, temporary, data)
  30. SELECT id, name, description, assetType, CONVERT(bit, local), CONVERT(bit, temporary), data FROM assets WITH (HOLDLOCK TABLOCKX)')
  31. DROP TABLE assets
  32. EXECUTE sp_rename N'Tmp_assets', N'assets', 'OBJECT'
  33. ALTER TABLE dbo.assets ADD CONSTRAINT
  34. PK__assets__id PRIMARY KEY CLUSTERED
  35. (
  36. id
  37. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  38. COMMIT
  39. :VERSION 3
  40. BEGIN TRANSACTION
  41. ALTER TABLE assets add create_time integer default 0
  42. ALTER TABLE assets add access_time integer default 0
  43. COMMIT
  44. :VERSION 4
  45. BEGIN TRANSACTION
  46. CREATE TABLE dbo.Tmp_assets
  47. (
  48. id uniqueidentifier NOT NULL,
  49. name varchar(64) NOT NULL,
  50. description varchar(64) NOT NULL,
  51. assetType tinyint NOT NULL,
  52. local bit NOT NULL,
  53. temporary bit NOT NULL,
  54. data image NOT NULL,
  55. create_time int NULL,
  56. access_time int NULL
  57. ) ON [PRIMARY]
  58. TEXTIMAGE_ON [PRIMARY]
  59. IF EXISTS(SELECT * FROM dbo.assets)
  60. EXEC('INSERT INTO dbo.Tmp_assets (id, name, description, assetType, local, temporary, data, create_time, access_time)
  61. SELECT CONVERT(uniqueidentifier, id), name, description, assetType, local, temporary, data, create_time, access_time FROM dbo.assets WITH (HOLDLOCK TABLOCKX)')
  62. DROP TABLE assets
  63. EXECUTE sp_rename N'Tmp_assets', N'assets', 'OBJECT'
  64. ALTER TABLE dbo.assets ADD CONSTRAINT
  65. PK__assets__id PRIMARY KEY CLUSTERED
  66. (
  67. id
  68. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  69. COMMIT
  70. :VERSION 5
  71. DELETE FROM assets WHERE id = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621';
  72. :VERSION 6
  73. ALTER TABLE assets ADD asset_flags INTEGER NOT NULL DEFAULT 0;
  74. :VERSION 7
  75. alter table assets add creatorid varchar(36) not null default '';