Skip to content

Commit

Permalink
resolve unexpected end-of-input in migration file
Browse files Browse the repository at this point in the history
  • Loading branch information
mosinski committed Aug 5, 2017
1 parent 1edf7e4 commit 7ebbf4b
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 9 deletions.
10 changes: 6 additions & 4 deletions lib/generators/ckeditor/install_generator.rb
Expand Up @@ -53,7 +53,7 @@ def create_models

def create_ckeditor_migration
if ['active_record'].include?(orm)
migration_template "#{generator_dir}/migration.rb",
migration_template "#{generator_dir}/#{migration_file}.rb",
File.join('db/migrate', 'create_ckeditor_assets.rb'),
migration_version: migration_version
end
Expand Down Expand Up @@ -94,9 +94,11 @@ def rails5?
end

def migration_version
if rails5?
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end

def migration_file
rails5? ? 'migration_versioned' : 'migration'
end
end
end
Expand Down
@@ -1,4 +1,4 @@
class CreateCkeditorAssets < ActiveRecord::Migration<%= migration_version %>
class CreateCkeditorAssets < ActiveRecord::Migration
def self.up
create_table :ckeditor_assets do |t|
t.string :data_file_name, null: false
Expand Down
@@ -0,0 +1,22 @@
class CreateCkeditorAssets < ActiveRecord::Migration<%= migration_version %>
def self.up
create_table :ckeditor_assets do |t|
t.string :data_file_name, null: false
t.string :data_content_type
t.integer :data_file_size
t.string :type, limit: 30

# Uncomment it to save images dimensions, if your need it
t.integer :width
t.integer :height

t.timestamps null: false
end

add_index :ckeditor_assets, :type
end

def self.down
drop_table :ckeditor_assets
end
end
@@ -1,4 +1,4 @@
class CreateCkeditorAssets < ActiveRecord::Migration<%= migration_version %>
class CreateCkeditorAssets < ActiveRecord::Migration
def self.up
create_table :ckeditor_assets do |t|
t.string :data_uid, null: false
Expand Down
@@ -0,0 +1,23 @@
class CreateCkeditorAssets < ActiveRecord::Migration<%= migration_version %>
def self.up
create_table :ckeditor_assets do |t|
t.string :data_uid, null: false
t.string :data_name, null: false
t.string :data_mime_type
t.integer :data_size
t.string :type, limit: 30

# Uncomment these to save image dimensions, if your need them.
t.integer :data_width
t.integer :data_height

t.timestamps null: false
end

add_index :ckeditor_assets, :type
end

def self.down
drop_table :ckeditor_assets
end
end
@@ -1,4 +1,4 @@
class CreateCkeditorAssets < ActiveRecord::Migration<%= migration_version %>
class CreateCkeditorAssets < ActiveRecord::Migration
def self.up
create_table :ckeditor_assets do |t|
t.string :data_file_name, null: false
Expand Down
@@ -0,0 +1,23 @@
class CreateCkeditorAssets < ActiveRecord::Migration<%= migration_version %>
def self.up
create_table :ckeditor_assets do |t|
t.string :data_file_name, null: false
t.string :data_content_type
t.integer :data_file_size
t.string :data_fingerprint
t.string :type, limit: 30

# Uncomment it to save images dimensions, if your need it
t.integer :width
t.integer :height

t.timestamps null: false
end

add_index :ckeditor_assets, :type
end

def self.down
drop_table :ckeditor_assets
end
end
@@ -1,4 +1,4 @@
class CreateCkeditorAssets < ActiveRecord::Migration<%= migration_version %>
class CreateCkeditorAssets < ActiveRecord::Migration
def self.up
create_table :ckeditor_assets do |t|
t.string :data_id, null: false
Expand Down
@@ -0,0 +1,23 @@
class CreateCkeditorAssets < ActiveRecord::Migration<%= migration_version %>
def self.up
create_table :ckeditor_assets do |t|
t.string :data_id, null: false
t.string :data_filename, null: false
t.integer :data_size
t.string :data_content_type
t.string :type, limit: 30

# Uncomment it to save images dimensions, if your need it
t.integer :width
t.integer :height

t.timestamps null: false
end

add_index :ckeditor_assets, :type
end

def self.down
drop_table :ckeditor_assets
end
end
2 changes: 1 addition & 1 deletion test/test_helper.rb
Expand Up @@ -7,7 +7,7 @@
puts "\n==> Ckeditor.orm = #{CKEDITOR_ORM.inspect}. CKEDITOR_ORM = (active_record|mongoid)"
puts "\n==> Ckeditor.backend = #{CKEDITOR_BACKEND.inspect}. CKEDITOR_BACKEND = (paperclip|carrierwave|refile|dragonfly)"

require File.expand_path("../dummy/config/environment.rb", __FILE__)
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rails/test_help"
require 'redgreen'

Expand Down

0 comments on commit 7ebbf4b

Please sign in to comment.