This file is indexed.

/usr/lib/ruby/vendor_ruby/sequel/plugins/schema.rb is in ruby-sequel 3.33.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
module Sequel
  module Plugins
    # Sequel's built in schema plugin allows you to define your schema
    # directly in the model using Model.set_schema (which takes a block
    # similar to Database#create_table), and use Model.create_table to
    # create a table using the schema information.
    #
    # This plugin is mostly suited to test code.  If there is any
    # chance that your application's schema could change, you should
    # be using the migration extension instead.
    # 
    # Usage:
    #
    #   # Add the schema methods to all model subclasses (called before loading subclasses)
    #   Sequel::Model.plugin :schema
    #
    #   # Add the schema methods to the Album class
    #   Album.plugin :schema
    module Schema
      module ClassMethods
        # Creates table, using the column information from set_schema.
        def create_table(*args, &block)
          set_schema(*args, &block) if block
          db.create_table(table_name, :generator=>@schema)
          @db_schema = get_db_schema(true)
          columns
        end
        
        # Drops the table if it exists and then runs create_table.  Should probably
        # not be used except in testing.
        def create_table!(*args, &block)
          drop_table rescue nil
          create_table(*args, &block)
        end

        # Creates the table unless the table already exists
        def create_table?(*args, &block)
          create_table(*args, &block) unless table_exists?
        end
        
        # Drops table.
        def drop_table
          db.drop_table(table_name)
        end
    
        # Returns table schema created with set_schema for direct descendant of Model.
        # Does not retreive schema information from the database, see db_schema if you
        # want that.
        def schema
          @schema || (superclass.schema unless superclass == Model)
        end
    
        # Defines a table schema (see Schema::Generator for more information).
        #
        # This is only needed if you want to use the create_table/create_table! methods.
        # Will also set the dataset if you provide a name, as well as setting
        # the primary key if you defined one in the passed block.
        #
        # In general, it is a better idea to use migrations for production code, as
        # migrations allow changes to existing schema.  set_schema is mostly useful for
        # test code or simple examples.
        def set_schema(name = nil, &block)
          set_dataset(db[name]) if name
          @schema = Sequel::Schema::Generator.new(db, &block)
          set_primary_key(@schema.primary_key_name) if @schema.primary_key_name
        end
        
        # Returns true if table exists, false otherwise.
        def table_exists?
          db.table_exists?(table_name)
        end
      end
    end
  end
end