diff --git a/docs/Cql/Migration.md b/docs/Cql/Migration.md index 63431b5..119876c 100644 --- a/docs/Cql/Migration.md +++ b/docs/Cql/Migration.md @@ -17,9 +17,7 @@ The `Migrator` class also provides methods to list applied and pending migration **Example** Creating a new migration ```crystal -class CreateUsersTable < Cql::Migration - self.version = 1_i64 - +class CreateUsersTable < Cql::Migration(1) def up schema.alter :users do add_column :name, String diff --git a/docs/Cql/Migrator.md b/docs/Cql/Migrator.md index dc2260c..e41cbd1 100644 --- a/docs/Cql/Migrator.md +++ b/docs/Cql/Migrator.md @@ -12,14 +12,6 @@ The `Migrator` class also provides methods to list applied and pending migration **Example** Creating a new migrator ```crystal -schema = Cql::Schema.define(:northwind, "sqlite3://db.sqlite3") do |s| - table :schema_migrations do - primary :id, Int32 - column :name, String - column :version, Int64, index: true, unique: true - timestamps - end -end migrator = Cql::Migrator.new(schema) ``` diff --git a/docs/coreconcepts/migrations.md b/docs/coreconcepts/migrations.md index c18eb43..cb328dc 100644 --- a/docs/coreconcepts/migrations.md +++ b/docs/coreconcepts/migrations.md @@ -17,9 +17,7 @@ Migrations allow you to: Let’s start with a simple example. Suppose we need to add a `users` table to our database with two columns: `name` and `age`. ```crystal -class CreateUsersTable < Cql::Migration - self.version = 1_i64 - +class CreateUsersTable < Cql::Migration(1) def up schema.alter :users do add_column :name, String @@ -158,9 +156,7 @@ This gives you details about the last migration that was successfully applied. Here’s an example where we define multiple migrations and apply them sequentially: ```crystal -class CreateMoviesTable < Cql::Migration - self.version = 2_i64 - +class CreateMoviesTable < Cql::Migration(2) def up schema.alter :movies do add_column :title, String diff --git a/src/migrations.cr b/src/migrations.cr index 1d2c407..4234d2c 100644 --- a/src/migrations.cr +++ b/src/migrations.cr @@ -13,9 +13,7 @@ module Cql # **Example** Creating a new migration # # ``` - # class CreateUsersTable < Cql::Migration - # self.version = 1_i64 - # + # class CreateUsersTable < Cql::Migration(1) # def up # schema.alter :users do # add_column :name, String @@ -35,14 +33,6 @@ module Cql # **Example** Applying migrations # # ``` - # schema = Cql::Schema.define(:northwind, "sqlite3://db.sqlite3") do |s| - # table :schema_migrations do - # primary :id, Int32 - # column :name, String - # column :version, Int64, index: true, unique: true - # timestamps - # end - # end # migrator = Cql::Migrator.new(schema) # migrator.up # ```