sequelize-rails 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4f3572fa044301c579e0760ae4ba8247d043093ab3c8756dfd380829806ac16
4
- data.tar.gz: f523555fe11cb97ff974e6f7f4949208b2071a272d5e28ab9fe70decce299839
3
+ metadata.gz: ed358e5bb7080bb8fe4c713a46b295cb7cd1c51de02cda2b6daf0580e2ae42be
4
+ data.tar.gz: 8382be25407a695811c735ca4bf93e4eddf709cc86bb9d501b948f2bfb090ec2
5
5
  SHA512:
6
- metadata.gz: 06bbac5d130b2fb85940230f313a8fe8907efc08084a851986f89868f7ee9e2a395c20d7ed52014d92b904fb5a6e79e068b3cdf47562d8f91890dd294f788a39
7
- data.tar.gz: 7cbfc94ec5c533cf05f3a4c81e625cec6dd3c7cab7aba972a62d7e68175749cb4abcf7a7e37b225dc99ea556d6319a912e39986e2b15f031a5b82089d19731f5
6
+ metadata.gz: f940cf5b229febd629e5a06ecf9d7c69cfb5a6e0ca36ede15bdcbebd3e836ea919b83eb8d20e9658d2a4339d26e3663684aab0781c20657a564a99d4ad9935e1
7
+ data.tar.gz: b9fea39afcb85fe6bfd7659e470f676b1df28e49355a90598f9e3a10fdf4011686c7d200f8e73790282a9de09839d92dc8afd95f75684090db168345eaa3d348
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.1] - 2023-09-04
4
+
5
+ - Migrations now generate SQL files by default
6
+
3
7
  ## [0.6.0] - 2023-09-04
4
8
 
5
9
  - Adds migration generator
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sequelize-rails (0.6.0)
4
+ sequelize-rails (0.6.1)
5
5
  activerecord (>= 6.0.0)
6
6
  rails (>= 6.0.0)
7
7
  sequel (>= 5.0.0)
@@ -15,6 +15,8 @@ module Sequel
15
15
 
16
16
  def create_migration_file
17
17
  migration_template "migration.rb.erb", "db/migrate/#{file_name}.rb"
18
+ migration_template "up.sql.erb", "db/migrate/#{file_name}_up.sql"
19
+ migration_template "down.sql.erb", "db/migrate/#{file_name}_down.sql"
18
20
  end
19
21
  end
20
22
  end
@@ -0,0 +1 @@
1
+ -- Write rollback migration here
@@ -1,9 +1,13 @@
1
1
  Sequel.migration do
2
2
  up do
3
- # Add forward migration code here
3
+ transaction do
4
+ run File.read(File.join(File.dirname(__FILE__), "#{File.basename(__FILE__, ".rb")}_up.sql"))
5
+ end
4
6
  end
5
7
 
6
8
  down do
7
- # Add rollback migration code here
9
+ transaction do
10
+ run File.read(File.join(File.dirname(__FILE__), "#{File.basename(__FILE__, ".rb")}_down.sql"))
11
+ end
8
12
  end
9
13
  end
@@ -0,0 +1 @@
1
+ -- Write forwards migration here
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sequel
4
4
  module Rails
5
- VERSION = "0.6.0"
5
+ VERSION = "0.6.1"
6
6
  end
7
7
  end
@@ -141,7 +141,17 @@ db_namespace = namespace ns do
141
141
  end
142
142
 
143
143
  desc "Rolls back the last migration and re-runs it"
144
- task redo: [:down, :up]
144
+ task redo: [:connection] do
145
+ # down
146
+ target = (migrator.applied_migrations[-2] || "0_").split("_", 2).first.to_i
147
+ migrator(target: target).run
148
+ # up
149
+ pending = migrator.migration_tuples.first
150
+ if pending
151
+ target = pending[1].split("_", 2).first.to_i
152
+ migrator(target: target).run
153
+ end
154
+ end
145
155
 
146
156
  desc "Displays the status of the database migrations"
147
157
  task status: [:connection] do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequelize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenaniah Cerny
@@ -165,7 +165,9 @@ files:
165
165
  - lib/sequel/generators/migration_generator.rb
166
166
  - lib/sequel/generators/model_generator.rb
167
167
  - lib/sequel/generators/templates/application_record.rb.tt
168
+ - lib/sequel/generators/templates/down.sql.erb
168
169
  - lib/sequel/generators/templates/migration.rb.erb
170
+ - lib/sequel/generators/templates/up.sql.erb
169
171
  - lib/sequel/plugins/pretty_print.rb
170
172
  - lib/sequel/rails.rb
171
173
  - lib/sequel/rails/db_console.rb