diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-06 09:06:53 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-06 14:19:01 +1000 |
| commit | 2df59141a12979c9869ad2e62d01e9f7432e2f7c (patch) | |
| tree | 977cb96903815bd67654dd255927ba911e1774c3 /src/wixext/SqlTableDefinitions.cs | |
| parent | 2b82ad224e45a6f9d052ae892ecbf85e436b0bdf (diff) | |
| download | wix-2df59141a12979c9869ad2e62d01e9f7432e2f7c.tar.gz wix-2df59141a12979c9869ad2e62d01e9f7432e2f7c.tar.bz2 wix-2df59141a12979c9869ad2e62d01e9f7432e2f7c.zip | |
Modernize SqlCompiler and tuples.
Diffstat (limited to 'src/wixext/SqlTableDefinitions.cs')
| -rw-r--r-- | src/wixext/SqlTableDefinitions.cs | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/wixext/SqlTableDefinitions.cs b/src/wixext/SqlTableDefinitions.cs new file mode 100644 index 00000000..e980aaae --- /dev/null +++ b/src/wixext/SqlTableDefinitions.cs | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Sql | ||
| 4 | { | ||
| 5 | using WixToolset.Data.WindowsInstaller; | ||
| 6 | |||
| 7 | public static class SqlTableDefinitions | ||
| 8 | { | ||
| 9 | public static readonly TableDefinition SqlDatabase = new TableDefinition( | ||
| 10 | "SqlDatabase", | ||
| 11 | new[] | ||
| 12 | { | ||
| 13 | new ColumnDefinition("SqlDb", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Primary key, non-localized token", modularizeType: ColumnModularizeType.Column), | ||
| 14 | new ColumnDefinition("Server", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "Primary key, name of server running SQL Server"), | ||
| 15 | new ColumnDefinition("Instance", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "Primary key, name of SQL Server instance"), | ||
| 16 | new ColumnDefinition("Database", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "Primary key, name of database in a SQL Server"), | ||
| 17 | new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key, Component used to determine install state ", modularizeType: ColumnModularizeType.Column), | ||
| 18 | new ColumnDefinition("User_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "User", keyColumn: 1, description: "Foreign key, User used to log into database", modularizeType: ColumnModularizeType.Column), | ||
| 19 | new ColumnDefinition("FileSpec_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "SqlFileSpec", keyColumn: 1, description: "Foreign key referencing SqlFileSpec.", modularizeType: ColumnModularizeType.Column), | ||
| 20 | new ColumnDefinition("FileSpec_Log", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "SqlFileSpec", keyColumn: 1, description: "Foreign key referencing SqlFileSpec.", modularizeType: ColumnModularizeType.Column), | ||
| 21 | new ColumnDefinition("Attributes", ColumnType.Number, 2, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 255, description: "1 == create on install, 2 == drop on uninstall, 4 == continue on error, 8 == drop on install, 16 == create on uninstall, 32 == confirm update existing table, 64 == create on reinstall, 128 == drop on reinstall"), | ||
| 22 | }, | ||
| 23 | tupleDefinitionName: "SqlDatabase", | ||
| 24 | tupleIdIsPrimaryKey: true | ||
| 25 | ); | ||
| 26 | |||
| 27 | public static readonly TableDefinition SqlFileSpec = new TableDefinition( | ||
| 28 | "SqlFileSpec", | ||
| 29 | new[] | ||
| 30 | { | ||
| 31 | new ColumnDefinition("FileSpec", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Primary key, non-localized token", modularizeType: ColumnModularizeType.Column), | ||
| 32 | new ColumnDefinition("Name", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "Logical name of filespec", modularizeType: ColumnModularizeType.Property), | ||
| 33 | new ColumnDefinition("Filename", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "Filename to use (path must exist)", modularizeType: ColumnModularizeType.Property), | ||
| 34 | new ColumnDefinition("Size", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "Initial size for file", modularizeType: ColumnModularizeType.Property), | ||
| 35 | new ColumnDefinition("MaxSize", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "Maximum size for file", modularizeType: ColumnModularizeType.Property), | ||
| 36 | new ColumnDefinition("GrowthSize", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "Size file should grow when necessary", modularizeType: ColumnModularizeType.Property), | ||
| 37 | }, | ||
| 38 | tupleDefinitionName: "SqlFileSpec", | ||
| 39 | tupleIdIsPrimaryKey: true | ||
| 40 | ); | ||
| 41 | |||
| 42 | public static readonly TableDefinition SqlScript = new TableDefinition( | ||
| 43 | "SqlScript", | ||
| 44 | new[] | ||
| 45 | { | ||
| 46 | new ColumnDefinition("Script", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Primary key, non-localized token"), | ||
| 47 | new ColumnDefinition("SqlDb_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "SqlDatabase", keyColumn: 1, description: "Foreign key, SQL Server key", modularizeType: ColumnModularizeType.Column), | ||
| 48 | new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key, Component used to determine install state", modularizeType: ColumnModularizeType.Column), | ||
| 49 | new ColumnDefinition("ScriptBinary_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Binary", keyColumn: 1, description: "Foreign key, Binary stream that contains SQL Script to execute", modularizeType: ColumnModularizeType.Column), | ||
| 50 | new ColumnDefinition("User_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "User", keyColumn: 1, description: "Foreign key, User used to log into database", modularizeType: ColumnModularizeType.Column), | ||
| 51 | new ColumnDefinition("Attributes", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, possibilities: "1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31", description: "1 == execute on install, 2 == execute on uninstall, 4 == continue on error, 8 == rollback on install, 16 == rollback on uninstall"), | ||
| 52 | new ColumnDefinition("Sequence", ColumnType.Number, 2, primaryKey: false, nullable: true, ColumnCategory.Unknown, description: "Order to execute SQL Queries in"), | ||
| 53 | }, | ||
| 54 | tupleDefinitionName: "SqlScript", | ||
| 55 | tupleIdIsPrimaryKey: true | ||
| 56 | ); | ||
| 57 | |||
| 58 | public static readonly TableDefinition SqlString = new TableDefinition( | ||
| 59 | "SqlString", | ||
| 60 | new[] | ||
| 61 | { | ||
| 62 | new ColumnDefinition("String", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Id for the SqlString", modularizeType: ColumnModularizeType.Column), | ||
| 63 | new ColumnDefinition("SqlDb_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "SqlDatabase", keyColumn: 1, description: "Foreign key, SQL Server key", modularizeType: ColumnModularizeType.Column), | ||
| 64 | new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key, Component used to determine install state", modularizeType: ColumnModularizeType.Column), | ||
| 65 | new ColumnDefinition("SQL", ColumnType.String, 0, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "SQL query to execute"), | ||
| 66 | new ColumnDefinition("User_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "User", keyColumn: 1, description: "Foreign key, User used to log into database", modularizeType: ColumnModularizeType.Column), | ||
| 67 | new ColumnDefinition("Attributes", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, possibilities: "1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31", description: "1 == execute on install, 2 == execute on uninstall, 4 == continue on error, 8 == rollback on install, 16 == rollback on uninstall"), | ||
| 68 | new ColumnDefinition("Sequence", ColumnType.Number, 2, primaryKey: false, nullable: true, ColumnCategory.Unknown, description: "Order to execute SQL Queries in"), | ||
| 69 | }, | ||
| 70 | tupleDefinitionName: "SqlString", | ||
| 71 | tupleIdIsPrimaryKey: true | ||
| 72 | ); | ||
| 73 | |||
| 74 | public static readonly TableDefinition[] All = new[] | ||
| 75 | { | ||
| 76 | SqlDatabase, | ||
| 77 | SqlFileSpec, | ||
| 78 | SqlScript, | ||
| 79 | SqlString, | ||
| 80 | }; | ||
| 81 | } | ||
| 82 | } | ||
