Sha256: 17dfd4e5e395f5412d218beabcd2db72aaeaffbac406afe7f20f70890f46a2a2

Contents?: true

Size: 955 Bytes

Versions: 11

Compression:

Stored size: 955 Bytes

Contents

require File.dirname(__FILE__) + '/table'

module SQL
  module Sqlite3

    def supports_schema_transactions?
      true
    end

    def table(table_name)
      SQL::Sqlite3::Table.new(self, table_name)
    end

    def recreate_database
      DataMapper.logger.info "Dropping #{@uri.path}"
      system "rm #{@uri.path}"
      # do nothing, sqlite will automatically create the database file
    end

    def supports_serial?
      true
    end

    class Table < SQL::Table
      def initialize(adapter, table_name)
        @columns = []
        adapter.query_table(table_name).each do |col_struct|
          @columns << SQL::Sqlite3::Column.new(col_struct)
        end
      end
    end

    class Column < SQL::Column
      def initialize(col_struct)
        @name, @type, @default_value, @primary_key = col_struct.name, col_struct.type, col_struct.dflt_value, col_struct.pk

        @not_null = col_struct.notnull == 0
      end
    end


  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
dm-migrations-0.9.10 lib/sql/sqlite3.rb
dm-migrations-0.9.6 lib/sql/sqlite3.rb
dm-migrations-0.9.4 lib/sql/sqlite3.rb
dm-migrations-0.9.5 lib/sql/sqlite3.rb
dm-migrations-0.9.3 lib/sql/sqlite3.rb
dm-migrations-0.9.7 lib/sql/sqlite3.rb
dm-migrations-0.9.8 lib/sql/sqlite3.rb
dm-migrations-0.9.9 lib/sql/sqlite3.rb
mack-data_mapper-0.8.2 lib/gems/dm-migrations-0.9.7/lib/sql/sqlite3.rb
mack-data_mapper-0.8.3.1 lib/gems/dm-migrations-0.9.9/lib/sql/sqlite3.rb
mack-data_mapper-0.8.3 lib/gems/dm-migrations-0.9.9/lib/sql/sqlite3.rb