using Kit.Helpers.Repository;

namespace Kit.Helpers.Service
{
    public class UpdateSQLiteAllToVersion1 : SQLiteVersionUpdateItem
    {
        public override string FileTypeKey => FileTypeKeys.SQLiteAll;
        public override int OldVersion => 0;
        public override int NewVersion => 1;

        private const string _createTableProcedures = @"
create table procedures (
    procedure_name text not null primary key,
    params text not null,
    text text not null
);
";

        public override void Execute(FileContentSqlite file)
        {
            file.ConnectionString.PrepareExecute(_createTableProcedures).AsSqlText().WithStrictSyntax().ExecuteNonQuery();
        }
    }
}
