mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-03-11 08:48:57 +00:00
Compare commits
7 Commits
build-1.7.
...
86e3f69989
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86e3f69989 | ||
|
|
4d19ac4d77 | ||
|
|
503d2f63c3 | ||
|
|
cb1bf60060 | ||
|
|
3a57371be9 | ||
|
|
63ca44bb78 | ||
|
|
3270403ea1 |
@@ -17,16 +17,27 @@ public class Migration(string migrationsPath)
|
|||||||
if (files.Count == 0) return;
|
if (files.Count == 0) return;
|
||||||
|
|
||||||
await using var connection = await CS2_SimpleAdmin.DatabaseProvider.CreateConnectionAsync();
|
await using var connection = await CS2_SimpleAdmin.DatabaseProvider.CreateConnectionAsync();
|
||||||
|
|
||||||
await using (var cmd = connection.CreateCommand())
|
await using (var cmd = connection.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = """
|
if (migrationsPath.Contains("sqlite", StringComparison.CurrentCultureIgnoreCase))
|
||||||
CREATE TABLE IF NOT EXISTS sa_migrations (
|
{
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
cmd.CommandText = """
|
||||||
version TEXT NOT NULL
|
CREATE TABLE IF NOT EXISTS sa_migrations (
|
||||||
);
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
version TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
""";
|
""";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd.CommandText = """
|
||||||
|
CREATE TABLE IF NOT EXISTS sa_migrations (
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
version VARCHAR(128) NOT NULL
|
||||||
|
);
|
||||||
|
""";
|
||||||
|
}
|
||||||
|
|
||||||
await cmd.ExecuteNonQueryAsync();
|
await cmd.ExecuteNonQueryAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ CREATE TABLE IF NOT EXISTS `sa_admins` (
|
|||||||
`flags` TEXT NULL,
|
`flags` TEXT NULL,
|
||||||
`immunity` int(11) NOT NULL DEFAULT 0,
|
`immunity` int(11) NOT NULL DEFAULT 0,
|
||||||
`server_id` INT NULL,
|
`server_id` INT NULL,
|
||||||
|
|
||||||
`ends` timestamp NULL,
|
`ends` timestamp NULL,
|
||||||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ CREATE TABLE IF NOT EXISTS `sa_groups_servers` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
ALTER TABLE `sa_admins` ADD `group_id` INT NULL AFTER `created`;
|
ALTER TABLE `sa_admins` ADD `group_id` INT NULL AFTER `created`;
|
||||||
|
|
||||||
ALTER TABLE `sa_groups_flags` ADD FOREIGN KEY (`group_id`) REFERENCES `sa_groups`(`id`) ON DELETE CASCADE;
|
ALTER TABLE `sa_groups_flags` ADD FOREIGN KEY (`group_id`) REFERENCES `sa_groups`(`id`) ON DELETE CASCADE;
|
||||||
ALTER TABLE `sa_groups_servers` ADD FOREIGN KEY (`group_id`) REFERENCES `sa_groups`(`id`) ON DELETE CASCADE;
|
ALTER TABLE `sa_groups_servers` ADD FOREIGN KEY (`group_id`) REFERENCES `sa_groups`(`id`) ON DELETE CASCADE;
|
||||||
ALTER TABLE `sa_admins` ADD FOREIGN KEY (`group_id`) REFERENCES `sa_groups`(`id`) ON DELETE SET NULL;
|
ALTER TABLE `sa_admins` ADD FOREIGN KEY (`group_id`) REFERENCES `sa_groups`(`id`) ON DELETE SET NULL;
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user