mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-19 02:51:51 +00:00
1.4.3a
- New feature permban permission (@css/permban) - CustomCommand fix - Version checker - Minor changes - Updated to CounterStrikeSharp 225 - Bump version to 1.4.3a
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MySqlConnector;
|
||||
|
||||
namespace CS2_SimpleAdmin;
|
||||
namespace CS2_SimpleAdmin.Database;
|
||||
|
||||
public class Database(string dbConnectionString)
|
||||
{
|
||||
private readonly string _dbConnectionString = dbConnectionString;
|
||||
|
||||
public MySqlConnection GetConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
var connection = new MySqlConnection(_dbConnectionString);
|
||||
var connection = new MySqlConnection(dbConnectionString);
|
||||
connection.Open();
|
||||
return connection;
|
||||
}
|
||||
@@ -27,7 +25,7 @@ public class Database(string dbConnectionString)
|
||||
{
|
||||
try
|
||||
{
|
||||
var connection = new MySqlConnection(_dbConnectionString);
|
||||
var connection = new MySqlConnection(dbConnectionString);
|
||||
await connection.OpenAsync();
|
||||
return connection;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MySqlConnector;
|
||||
|
||||
namespace CS2_SimpleAdmin;
|
||||
namespace CS2_SimpleAdmin.Database;
|
||||
|
||||
public class Migration(Database database)
|
||||
{
|
||||
private readonly Database _database = database;
|
||||
|
||||
public void ExecuteMigrations()
|
||||
{
|
||||
var migrationsDirectory = CS2_SimpleAdmin.Instance.ModuleDirectory + "/Database/Migrations";
|
||||
@@ -14,11 +12,10 @@ public class Migration(Database database)
|
||||
var files = Directory.GetFiles(migrationsDirectory, "*.sql")
|
||||
.OrderBy(f => f);
|
||||
|
||||
using var connection = _database.GetConnection();
|
||||
using var connection = database.GetConnection();
|
||||
|
||||
// Create sa_migrations table if not exists
|
||||
using var cmd = new MySqlCommand("""
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `sa_migrations` (
|
||||
`id` INT PRIMARY KEY AUTO_INCREMENT,
|
||||
`version` VARCHAR(255) NOT NULL
|
||||
|
||||
Reference in New Issue
Block a user