Sha256: ac537c9840198059672c33c8990776b748de7330caa603187153a09ee45803af

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

module DB
	module Migrate
		class InformationSchema
			def initialize(session)
				@session = session
			end
			
			TABLES = DB::Identifier[:information_schema, :tables]
			
			def table_exist?(name)
				statement = @session.clause("SELECT * FROM")
				statement.identifier(TABLES)
				statement.clause("WHERE")
				statement.identifier(:table_name)
				statement.clause("=")
				statement.literal(name)
				
				return statement.call.to_a.any?
			end
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
db-migrate-x-0.2.0 lib/db/migrate/information_schema.rb