Allianaab2m/aya/kit does not have a README file

    KitError

    pub(all) suberror KitError {
    BadConfig(reason~ : String)
    BadJournal(reason~ : String)
    DialectMismatch(journal~ : String, config~ : String)
    } derive(
    Debug
    )

    impl Show for KitError

    Config

    pub(all) struct Config {
    dialect :
    Dialect

    schema : Array[String]
    out : String
    } derive(Eq,
    Debug
    )

    Where the project keeps its schema and its migrations.

    A file rather than flags, for the same reason drizzle has one: every command needs the same three answers, and a repository should not depend on each developer typing them the same way.

    Config::from_json_string

    fn Config::from_json_string(text : String) -> Config raise KitError

    Read a config file.

    Every key is optional: a project that only overrides schema should not have to restate the defaults.

    Config::journal_path

    fn Config::journal_path(self : Config) -> String

    Config::meta_dir

    fn Config::meta_dir(self : Config) -> String

    Config::migration_path

    fn Config::migration_path(self : Config, tag : String) -> String

    Config::new

    fn Config::new() -> Config

    What a project gets without a config file.

    Config::snapshot_path

    fn Config::snapshot_path(self : Config, idx : Int) -> String

    Config::to_json_string

    fn Config::to_json_string(self : Config) -> String

    Render a config file, for aya-kit init.

    Journal

    pub(all) struct Journal {
    version : String
    dialect :
    Dialect

    entries : Array[JournalEntry]
    } derive(Eq,
    Debug
    )

    The index of the migrations directory.

    The directory listing cannot be the index: file names sort lexically, tell you nothing about which dialect they were written for, and say nothing when one is deleted by hand.

    Journal::from_json_string

    fn Journal::from_json_string(text : String) -> Journal raise KitError

    Journal::last

    fn Journal::last(self : Journal) -> JournalEntry?

    The last migration generated, if any.

    Journal::new

    Journal::next_index

    fn Journal::next_index(self : Journal) -> Int

    The index the next migration will take.

    Journal::to_json_string

    fn Journal::to_json_string(self : Journal) -> String

    JournalEntry

    pub(all) struct JournalEntry {
    idx : Int
    tag : String
    when_ : Int64
    breakpoints : Bool
    } derive(Eq,
    Debug
    )

    One migration that has been generated, in the order it must run.

    Migration

    pub struct Migration {
    idx : Int
    tag : String
    sql : String
    snapshot : String
    } derive(Eq,
    Debug
    )

    A migration, as the three files it becomes.

    Produced without touching the filesystem so that the interesting part — what SQL a schema edit turns into — is testable, and so a failure part-way through cannot leave a .sql on disk with no snapshot beside it.

    Plan

    pub struct Plan {
    changes : Array[
    Change
    ]
    migration : Migration?
    journal : Journal
    } derive(Eq,
    Debug
    )

    What generate would do.

    CONFIG_FILE

    let CONFIG_FILE : String

    The name looked for when --config is not given.

    JOURNAL_VERSION

    let JOURNAL_VERSION : String

    describe

    fn describe(changes : Array[
    Change
    ]) -> String

    A short report of what a plan would change, one line per change.

    pad_index

    fn pad_index(idx : Int) -> String

    A four-digit migration index: 12 -> 0012.

    Fixed width so the directory sorts the way the migrations run, which is the order anyone reading it will assume anyway.

    plan

    fn plan(journal~ : Journal, previous~ :
    Snapshot
    , next~ :
    Snapshot
    , now~ : Int64, name? : String) -> Plan raise

    Work out the next migration from the two snapshots around it.

    name overrides the generated slug; without one the migration is named after its first change, so the migrations directory reads as a changelog.

    snapshot_of_sources

    fn snapshot_of_sources(sources : Array[(String, String)], dialect~ :
    Dialect
    ) ->
    Snapshot
    raise

    Parse every schema source and lower them all into one snapshot.

    Sources are (name, contents) pairs; the name only ever shows up in a parse error, so the caller decides whether that is a path or something else.