#Do migrations inside of the sql plugin for tauri being ran inside of transaction?

27 messages · Page 1 of 1 (latest)

dawn meadow
#

Talking about this:

use tauri_plugin_sql::{Builder, Migration, MigrationKind};

fn main() {
    let migrations = vec![
        // Define your migrations here
        Migration {
            version: 1,
            description: "create_initial_tables",
            sql: "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);",
            kind: MigrationKind::Up,
        }
    ];

    tauri::Builder::default()
        .plugin(
            tauri_plugin_sql::Builder::default()
                .add_migrations("sqlite:mydatabase.db", migrations)
                .build(),
        )
        ...
}

are migrations automatically ran inside of transactions or do i need to put them inside transactions explictly?

vale badger
#

also you can implement drizzle on the TS side

dawn meadow
#

i am asking if migrations are ran through plugin-sql with transactions or not

#

meaning do i manually have to specify a transaction within my sql file for each migration

vale badger
#

i dont really know what u mean lol

dawn meadow
#

do you know what are transactiosn?

vale badger
dawn meadow
#

that has nothing to do with what i am asking...

vale badger
#

bruh

#

i dont know what else you could want from this

dawn meadow
#

please leave it until someone who knows what i am talking about responds

red mortar
dawn meadow
#

Unless explicitly set to no tx

#

@red mortar I think this could be addressed in the docs about migrations that migrations are ran inside transactions automatically

I wouldn't mind helping to write this and create a pr

vale badger
dawn meadow
#

@red mortar i am trying to add a note to the page about SQL but it seems like the file is broken? at least in github's markdown renderer

should i ignore that?

red mortar
#

yeah just ignore that

#

or try replacing the ```` with ``` - idk why there are 4 backticks

dawn meadow
red mortar
#

thanks :)

dawn meadow
red mortar
#

looks fine to me