Skip to content

Commit

Permalink
feat: replace "!" with "+" in commands
Browse files Browse the repository at this point in the history
Closes #6
  • Loading branch information
vladfaust committed Jan 28, 2018
1 parent 99889c0 commit fda0400
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In comparsion to [micrate.cr](https://github.com/juanedi/micrate):
- Actual migration version is stored in a database table `"version"` (can be changed) with a single value `"version"` (can be changed as well).
- CLI removed.

This shard **is not compatible** with [micrate.cr](https://github.com/juanedi/micrate), because it uses diferrent notations in SQL files (`-- !migrate Up` instead of `-- !micrate Up`) and db scheme (see above). In fact, if you really want, you can transfer your existing app to Migrate, but this will require some manual changes.
This shard **is not compatible** with [micrate.cr](https://github.com/juanedi/micrate), because it uses diferrent notations in SQL files (`-- +migrate Up` instead of `-- !micrate Up`) and db scheme (see above). In fact, if you really want, you can transfer your existing app to Migrate, but this will require some manual changes.

## Installation

Expand All @@ -35,7 +35,7 @@ dependencies:
`db/migrations/1.sql`:

```sql
-- !migrate up
-- +migrate up
CREATE TABLE foo (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL
Expand All @@ -44,14 +44,14 @@ CREATE TABLE foo (
-- Indexes (it's just a comment, no utility function)
CREATE UNIQUE INDEX foo_content_index ON foo (content);
-- !migrate down
-- +migrate down
DROP TABLE foo;
```

`db/migrations/2_create_bar.sql`:

```sql
-- !migrate up
-- +migrate up
CREATE TABLE bar (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL
Expand All @@ -60,14 +60,14 @@ CREATE TABLE bar (
-- Indexes
CREATE UNIQUE INDEX bar_content_index ON bar (content);
-- !migrate down
-- +migrate down
DROP TABLE bar;
```

`db/migrations/10_create_baz.sql`:

```sql
-- !migrate up
-- +migrate up
CREATE TABLE baz (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL
Expand All @@ -76,7 +76,7 @@ CREATE TABLE baz (
-- Indexes
CREATE UNIQUE INDEX baz_content_index ON baz (content);
-- !migrate down
-- +migrate down
DROP TABLE baz;
```

Expand Down
4 changes: 2 additions & 2 deletions spec/migrate/migration_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "../spec_helper"

describe Migrate::Migration do
migration_sql = <<-SQL
-- !migrate up
-- +migrate up
CREATE TABLE foo (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL
Expand All @@ -11,7 +11,7 @@ describe Migrate::Migration do
-- Indexes
CREATE UNIQUE INDEX foo_content_index ON foo (content);
-- !migrate down
-- +migrate down
DROP TABLE foo;
SQL
Expand Down
4 changes: 2 additions & 2 deletions spec/migrations/1.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- !migrate up
-- +migrate up
CREATE TABLE foo (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL
Expand All @@ -7,5 +7,5 @@ CREATE TABLE foo (
-- Indexes
CREATE UNIQUE INDEX foo_content_index ON foo (content);

-- !migrate down
-- +migrate down
DROP TABLE foo;
4 changes: 2 additions & 2 deletions spec/migrations/10_create_baz.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- !migrate up
-- +migrate up
CREATE TABLE baz (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL
Expand All @@ -7,5 +7,5 @@ CREATE TABLE baz (
-- Indexes
CREATE UNIQUE INDEX baz_content_index ON baz (content);

-- !migrate down
-- +migrate down
DROP TABLE baz;
4 changes: 2 additions & 2 deletions spec/migrations/2_create_bar.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- !migrate up
-- +migrate up
CREATE TABLE bar (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL
Expand All @@ -7,5 +7,5 @@ CREATE TABLE bar (
-- Indexes
CREATE UNIQUE INDEX bar_content_index ON bar (content);

-- !migrate down
-- +migrate down
DROP TABLE bar;
2 changes: 1 addition & 1 deletion src/migrate/migration.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Migrate
# :nodoc:
struct Migration
CMD_PREFIX = "-- !migrate"
CMD_PREFIX = "-- +migrate"

getter queries_up = Array(String).new, queries_down = Array(String).new

Expand Down

0 comments on commit fda0400

Please sign in to comment.