source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/store.rb | Ruby | mit | 191 | main | 628 | # == Schema Information
#
# Table name: stores
#
# id :bigint not null, primary key
# address :string
# email :string
# name :string
# phone :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
#
# Indexes
#
# index_s... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/supplier.rb | Ruby | mit | 191 | main | 594 | # frozen_string_literal: true
# == Schema Information
#
# Table name: suppliers
#
# id :bigint not null, primary key
# address :string
# cellphone :string
# city :string
# cnpj :string
# email :string
# landmark :string
# name :string
# note :string
# phon... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/simplo_order_payment.rb | Ruby | mit | 191 | main | 2,386 | # frozen_string_literal: true
# == Schema Information
#
# Table name: simplo_order_payments
#
# id :bigint not null, primary key
# client_name :string
# codigo_transacao :string
# data_pedido :string
# integrador :string
# order_status :string
# pagamento_forma :stri... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/customer.rb | Ruby | mit | 191 | main | 796 | # frozen_string_literal: true
# == Schema Information
#
# Table name: customers
#
# id :bigint not null, primary key
# cellphone :string
# cpf :string
# email :string
# name :string
# phone :string
# created_at :datetime not null
# updated_at :datetime ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/finance_datum.rb | Ruby | mit | 191 | main | 351 | # == Schema Information
#
# Table name: finance_data
#
# id :bigint not null, primary key
# date :date
# expense :decimal(, )
# fixed_amount :decimal(, )
# income :decimal(, )
# created_at :datetime not null
# updated_at :datetime not null
#
class Financ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/simplo_order.rb | Ruby | mit | 191 | main | 3,087 | # frozen_string_literal: true
# == Schema Information
#
# Table name: simplo_orders
#
# id :bigint not null, primary key
# client_name :string
# order_date :string
# order_status :string
# created_at :datetime not null
# updated_at :datetime not null
# order_id :st... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/product.rb | Ruby | mit | 191 | main | 6,687 | # frozen_string_literal: true
# == Schema Information
#
# Table name: products
#
# id :bigint not null, primary key
# active :boolean
# bar_code :string
# extra_sku :string
# highlight ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/revenue_estimation.rb | Ruby | mit | 191 | main | 1,121 | # frozen_string_literal: true
# == Schema Information
#
# Table name: revenue_estimations
#
# id :bigint not null, primary key
# average_ticket :decimal(, )
# date :date
# quantity :integer
# revenue :decimal(, )
# created_at :datetime not null
# updated_... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/account_feature.rb | Ruby | mit | 191 | main | 552 | # == Schema Information
#
# Table name: account_features
#
# id :bigint not null, primary key
# is_enabled :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint not null
# feature_id :integer not n... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/stock.rb | Ruby | mit | 191 | main | 5,823 | # == Schema Information
#
# Table name: stocks
#
# id :bigint not null, primary key
# total_balance :integer
# total_virtual_balance :integer
# created_at :datetime not null
# updated_at :datetime not null
# a... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/localization.rb | Ruby | mit | 191 | main | 676 | # == Schema Information
#
# Table name: localizations
#
# id :bigint not null, primary key
# address :string
# city :string
# complement :string
# country_name :string
# name :string
# neighborhood :string
# number ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/purchase_product.rb | Ruby | mit | 191 | main | 2,441 | # frozen_string_literal: true
# == Schema Information
#
# Table name: purchase_products
#
# id :bigint not null, primary key
# quantity :integer
# store_entrance :integer default("Sem_Loja")
# value :float
# created_at :datetime not null
# updated_at ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/find_orders.rb | Ruby | mit | 191 | main | 2,106 | # frozen_string_literal: true
module Services
module Bling
class FindOrders < ApplicationService
attr_accessor :ids, :order_command, :tenant
def initialize(order_command:, tenant:, ids:)
@order_command = order_command
@tenant = tenant
@ids = ids
end
def call
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/find_and_update_bling_order_item.rb | Ruby | mit | 191 | main | 2,751 | # frozen_string_literal: true
module Services
module Bling
class FindAndUpdateBlingOrderItem < ApplicationService
attr_reader :identifier, :account_id
def initialize(identifier:, account_id:)
@identifier = identifier
@account_id = account_id
end
def call
bling_or... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/update_order_status.rb | Ruby | mit | 191 | main | 1,273 | # frozen_string_literal: true
module Services
module Bling
class UpdateOrderStatus < ApplicationService
BASE_URL = 'https://www.bling.com.br/Api/v3/pedidos/vendas/'
attr_accessor :tenant, :order_ids, :new_status
def initialize(tenant:, order_ids:, new_status:)
@tenant = tenant
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/fetch_modules.rb | Ruby | mit | 191 | main | 1,242 | # frozen_string_literal: true
module Services
module Bling
class FetchModules < ApplicationService
attr_accessor :tenant
def initialize(tenant:)
@tenant = tenant
end
def call
fetch_modules
end
private
def fetch_modules
token = bling_token
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/product.rb | Ruby | mit | 191 | main | 2,362 | # frozen_string_literal: true
module Services
module Bling
# Service::Bling::Product is used in the GoodJob service to get products from Bling API
# Model Product.synchronize_bling uses it to create/update itself according to bling products.
class Product < ApplicationService
attr_accessor :product... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/stock.rb | Ruby | mit | 191 | main | 1,961 | # frozen_string_literal: true
module Services
module Bling
# Service::Bling::Stock is used in the GoodJob service to get stocks from Bling API
# Model Stock.synchronize_bling uses it to create/update itself according to bling stocks.
class Stock < ApplicationService
attr_accessor :stock_command, :t... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/find_order.rb | Ruby | mit | 191 | main | 1,152 | # frozen_string_literal: true
module Services
module Bling
class FindOrder < ApplicationService
attr_accessor :id, :order_command, :tenant
def initialize(id:, order_command:, tenant:)
@id = id
@order_command = order_command
@tenant = tenant
end
def call
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/order.rb | Ruby | mit | 191 | main | 1,876 | # frozen_string_literal: true
module Services
module Bling
class Order < ApplicationService
attr_accessor :order_command, :tenant, :situation, :options
def initialize(order_command:, tenant:, situation:, options: {})
@order_command = order_command
@tenant = tenant
@situation ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/create_stock_record.rb | Ruby | mit | 191 | main | 2,959 | # frozen_string_literal: true
require 'net/http'
require 'uri'
require 'json'
module Services
module Bling
class CreateStockRecord < ApplicationService
VALID_OPERATIONS = {
'B' => 'balanço',
'E' => 'entrada',
'S' => 'saída'
}.freeze
attr_reader :warehouse_id, :product_... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/warehouses.rb | Ruby | mit | 191 | main | 1,192 | # frozen_string_literal: true
module Services
module Bling
class Warehouses < ApplicationService
attr_reader :tenant, :options
def initialize(tenant:, options: {})
@tenant = tenant
@options = options
end
def call
find_warehouses
end
private
de... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/product_details.rb | Ruby | mit | 191 | main | 1,349 | # frozen_string_literal: true
module Services
module Bling
# Service::Bling::ProductDetails is used to get a single product's details from Bling API
class ProductDetails < ApplicationService
attr_accessor :product_id, :tenant
def initialize(product_id:, tenant:)
@product_id = product_id
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/bling/fetch_module_situations.rb | Ruby | mit | 191 | main | 1,961 | # frozen_string_literal: true
module Services
module Bling
class FetchModuleSituations < ApplicationService
attr_accessor :tenant, :module_id
def initialize(tenant:, module_id:)
@tenant = tenant
@module_id = module_id
end
def call
fetch_and_save_module_situations... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/pdf/payment_order_pdf_generator.rb | Ruby | mit | 191 | main | 7,678 | require 'prawn'
module Services
module Pdf
class PaymentOrderPdfGenerator
include ActionView::Helpers::NumberHelper
def initialize(production)
@production = production
end
def generate
Prawn::Document.new do |pdf|
setup_font(pdf)
generate_header(pdf)
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/pdf/service_order_pdf_generator.rb | Ruby | mit | 191 | main | 5,665 | require 'prawn'
module Services
module Pdf
class ServiceOrderPdfGenerator
include ActionView::Helpers::NumberHelper
def initialize(production)
@production = production
end
def generate
Prawn::Document.new do |pdf|
setup_font(pdf)
generate_header(pdf)
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/product/duplicate.rb | Ruby | mit | 191 | main | 369 | # frozen_string_literal: true
module Services
module Product
class Duplicate < ApplicationService
attr_reader :product
def initialize(product:)
@product = product
end
def call
product_clone = @product.dup
product_clone.name = "#{product_clone.name} Cópia"
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/product/count_quantity.rb | Ruby | mit | 191 | main | 1,031 | # frozen_string_literal: true
module Services
module Product
class CountQuantity < ApplicationService
attr_accessor :product, :product_command
def initialize(product:, product_command:)
@product = product
@product_command = product_command
end
def call
case produ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/product/generate_qr_code_pdf.rb | Ruby | mit | 191 | main | 3,908 | require 'prawn'
require 'tempfile'
module Services
module Product
class GenerateQrCodePdf
include Prawn::View
QR_CODE_WIDTH = 200
QR_CODE_HEIGHT = 250 # Total height including QR code and text
HORIZONTAL_SPACING = 50
VERTICAL_SPACING = 30
TEXT_MARGIN = 15 # Space betwee... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/product/update_status.rb | Ruby | mit | 191 | main | 487 | # frozen_string_literal: true
module Services
module Product
class UpdateStatus < ApplicationService
attr_reader :product
def initialize(product:)
@product = product
end
def call
if @product.active.eql? true
@product.update(active: false)
else
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/services/product/generate_qr_code.rb | Ruby | mit | 191 | main | 1,103 | # frozen_string_literal: true
require 'rqrcode'
module Services
module Product
class GenerateQrCode < ApplicationService
attr_reader :product, :width, :height
def initialize(product:, width: 300, height: 300)
@product = product
@width = width
@height = height
end
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/updates/order.rb | Ruby | mit | 191 | main | 547 | # frozen_string_literal: true
module Updates
class Order
attr_reader :id, :data
def initialize(id:, data:)
@id = id
@data = data
end
def call
make_update
end
private
def make_update
HTTParty.put(uri_for_update, body: data, headers:)
end
def base_uri
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/integrations/simplo7/simplo_service.rb | Ruby | mit | 191 | main | 3,020 | # frozen_string_literal: true
module Integrations
module Simplo7
class SimploService
def self.integrate_orders(id, store_sale)
sale = Sale.where(order_code: id).first
id = (id.to_i + 1).to_s
if sale.nil?
order = Requests::Order.new(id:).call
customer = Customer.... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/requests/product.rb | Ruby | mit | 191 | main | 683 | # frozen_string_literal: true
module Requests
class Product
attr_reader :page, :id
def initialize(page: nil, id: nil)
@page = page
@id = id
end
def call
make_request
end
private
def make_resquest
return HTTParty.get(uri_for_page, headers:) if page
HTTPar... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/requests/order.rb | Ruby | mit | 191 | main | 1,050 | # frozen_string_literal: true
module Requests
class Order
attr_reader :page, :id, :custom_uri
def initialize(page: nil, id: nil, custom_uri: nil)
@page = page
@id = id
@custom_uri = custom_uri
end
def call
return custom_request if custom_uri
make_request
end
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/models/concerns/chronological_order.rb | Ruby | mit | 191 | main | 250 | # frozen_string_literal: true
module ChronologicalOrder
extend ActiveSupport::Concern
included do
scope :chronologically, -> { order :created_at, :id }
scope :reverse_chronologically, -> { order created_at: :desc, id: :desc }
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/enumerations/feature_key.rb | Ruby | mit | 191 | main | 216 | # frozen_string_literal: true
# Check the doc at https://github.com/lucascaton/enumerate_it#using-enumerations
class FeatureKey < EnumerateIt::Base
associate_values(
stock: 0,
bling_integration: 1
)
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/enumerations/bling_order_item_status.rb | Ruby | mit | 191 | main | 454 | # frozen_string_literal: true
# Check the doc at https://github.com/lucascaton/enumerate_it#using-enumerations
class BlingOrderItemStatus < EnumerateIt::Base
associate_values(
all: '99',
in_progress: '15',
checked: '101065',
verified: '24',
pending: '94871',
printed: '95745',
canceled: '1... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/enumerations/bling_order_item_store.rb | Ruby | mit | 191 | main | 424 | # frozen_string_literal: true
# Check the doc at https://github.com/lucascaton/enumerate_it#using-enumerations
class BlingOrderItemStore < EnumerateIt::Base
associate_values(
:all => '99',
'Shein' => '204219105',
'Shopee' => '203737982',
'Simplo 7' => '203467890',
'Mercado Livre' => '204061683',
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/policies/application_policy.rb | Ruby | mit | 191 | main | 961 | # frozen_string_literal: true
class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
def index?
bling_feature_flag?
end
def show?
bling_feature_flag?
end
def create?
bling_feature_flag?
end
def new?
bling_featur... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/policies/account_policy.rb | Ruby | mit | 191 | main | 324 | # frozen_string_literal: true
class AccountPolicy
attr_reader :account, :enabled
def initialize(account)
@account = account
@enabled ||= account.account_features.includes([:feature])
.select { |account_feature| account_feature.feature.bling_integration? }&.first&.is_enabled?
end
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/policies/bling_order_item_policy.rb | Ruby | mit | 191 | main | 228 | class BlingOrderItemPolicy < ApplicationPolicy
def others_status?
index?
end
class Scope < Scope
# NOTE: Be explicit about which records you allow access to!
# def resolve
# scope.all
# end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/helpers/shein_orders_helper.rb | Ruby | mit | 191 | main | 2,722 | # app/helpers/shein_orders_helper.rb
module SheinOrdersHelper
def time_remaining(shein_order)
collection_deadline = parse_portuguese_date(shein_order.data['Prazo final de coleta'])
if collection_deadline
# Adjust the time zone difference to +3 hours (180 minutes)
time_difference = collection... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/helpers/bling_order_items_helper.rb | Ruby | mit | 191 | main | 353 | # frozen_string_literal: true
# Move the logic of the views/bling_order_items/* to here.
module BlingOrderItemsHelper
EDIT_BLING_ORDER_URL = 'https://www.bling.com.br/b/vendas.php#edit/'
def link_to_external_bling_order(bling_order_id)
link_to bling_order_id, EDIT_BLING_ORDER_URL + bling_order_id, target: '_b... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/helpers/application_helper.rb | Ruby | mit | 191 | main | 2,529 | # frozen_string_literal: true
module ApplicationHelper
include Pagy::Frontend
def page_title
content_for(:page_title) || Rails.application.class.to_s.split('::').first
end
def account_policy_enabled?
@account_policy ||= AccountPolicy.new(current_user.account).enabled
end
def crud_actions
%w[... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/helpers/home_helper.rb | Ruby | mit | 191 | main | 208 | module HomeHelper
def absent_stores(grouped_order_items)
present_stores = grouped_order_items.keys
all_stores = BlingOrderItem::STORE_ID_NAME_KEY_VALUE.keys
all_stores - present_stores
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/schema.rb | Ruby | mit | 191 | main | 19,882 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/seeds.rb | Ruby | mit | 191 | main | 1,735 | # frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name:... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20241108183006_add_estrutura_to_products.rb | Ruby | mit | 191 | main | 234 | class AddEstruturaToProducts < ActiveRecord::Migration[7.0]
def change
add_column :products, :tipo_estoque, :string
add_column :products, :lancamento_estoque, :string
add_column :products, :componentes, :jsonb
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20200629181858_create_post_data.rb | Ruby | mit | 191 | main | 340 | # frozen_string_literal: true
class CreatePostData < ActiveRecord::Migration[6.0]
def change
create_table :post_data do |t|
t.string :client_name
t.string :cep
t.string :state
t.string :post_code
t.string :post_type
t.float :value
t.datetime :send_date
t.timestamp... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20231217160425_create_production_products.rb | Ruby | mit | 191 | main | 307 | class CreateProductionProducts < ActiveRecord::Migration[7.0]
def change
create_table :production_products do |t|
t.references :production, null: false, foreign_key: true
t.references :product, null: false, foreign_key: true
t.integer :quantity
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20201204001321_create_simplo_order_payments.rb | Ruby | mit | 191 | main | 441 | # frozen_string_literal: true
class CreateSimploOrderPayments < ActiveRecord::Migration[6.0]
def change
create_table :simplo_order_payments do |t|
t.string :order_id
t.string :client_name
t.string :integrador
t.string :pagamento_forma
t.string :codigo_transacao
t.string :parce... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20241001172500_add_indexes_to_stocks_and_productions.rb | Ruby | mit | 191 | main | 699 | class AddIndexesToStocksAndProductions < ActiveRecord::Migration[6.1]
def change
add_index :stocks, :account_id unless index_exists?(:stocks, :account_id)
add_index :stocks, :product_id unless index_exists?(:stocks, :product_id)
add_index :productions, :confirmed unless index_exists?(:productions, :confir... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20220218122440_change_data_type_for_custom_id.rb | Ruby | mit | 191 | main | 201 | # frozen_string_literal: true
class ChangeDataTypeForCustomId < ActiveRecord::Migration[6.0]
def change
change_column :products, :custom_id, 'integer USING CAST(custom_id AS integer)'
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240117192514_create_good_job_executions.rb | Ruby | mit | 191 | main | 879 | # frozen_string_literal: true
class CreateGoodJobExecutions < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.table_exists?(:good_job_executions)
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20230806095741_create_bling_data.rb | Ruby | mit | 191 | main | 371 | class CreateBlingData < ActiveRecord::Migration[7.0]
def change
create_table :bling_data do |t|
t.string :access_token
t.integer :expires_in
t.datetime :expires_at
t.string :token_type
t.text :scope
t.string :refresh_token
t.integer :account_id
t.timestamps
end... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20231221140612_create_stocks.rb | Ruby | mit | 191 | main | 264 | class CreateStocks < ActiveRecord::Migration[7.0]
def change
create_table :stocks do |t|
t.integer :product_id
t.bigint :bling_product_id
t.integer :total_balance
t.integer :total_virtual_balance
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240117192516_recreate_good_job_cron_indexes_with_conditional.rb | Ruby | mit | 191 | main | 2,206 | # frozen_string_literal: true
class RecreateGoodJobCronIndexesWithConditional < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at_cond)
add_index :g... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20230906013257_create_good_jobs.rb | Ruby | mit | 191 | main | 3,229 | # frozen_string_literal: true
class CreateGoodJobs < ActiveRecord::Migration[7.0]
def change
# Uncomment for Postgres v12 or earlier to enable gen_random_uuid() support
enable_extension 'pgcrypto'
create_table :good_jobs, id: :uuid do |t|
t.text :queue_name
t.integer :priority
t.jsonb ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20200713134711_create_simplo_products.rb | Ruby | mit | 191 | main | 222 | # frozen_string_literal: true
class CreateSimploProducts < ActiveRecord::Migration[6.0]
def change
create_table :simplo_products do |t|
t.string :name
t.string :sku
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240117192512_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb | Ruby | mit | 191 | main | 712 | # frozen_string_literal: true
class CreateIndexGoodJobsJobsOnPriorityCreatedAtWhenUnfinished < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191012214058_create_purchase_products.rb | Ruby | mit | 191 | main | 327 | # frozen_string_literal: true
class CreatePurchaseProducts < ActiveRecord::Migration[6.0]
def change
create_table :purchase_products do |t|
t.integer :quantity
t.float :value
t.references :product, foreign_key: true
t.references :purchase, foreign_key: true
t.timestamps
end
e... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20200903004457_create_simplo_clients.rb | Ruby | mit | 191 | main | 250 | # frozen_string_literal: true
class CreateSimploClients < ActiveRecord::Migration[6.0]
def change
create_table :simplo_clients do |t|
t.string :name
t.integer :age
t.datetime :order_date
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20210107094049_add_account_to_suppliers.rb | Ruby | mit | 191 | main | 200 | # frozen_string_literal: true
class AddAccountToSuppliers < ActiveRecord::Migration[6.0]
def change
add_column :suppliers, :account_id, :integer
add_index :suppliers, :account_id
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20210104205754_add_account_to_purchase_products.rb | Ruby | mit | 191 | main | 223 | # frozen_string_literal: true
class AddAccountToPurchaseProducts < ActiveRecord::Migration[6.0]
def change
add_column :purchase_products, :account_id, :integer
add_index :purchase_products, :account_id
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191102180750_create_active_storage_tables.active_storage.rb | Ruby | mit | 191 | main | 1,044 | # frozen_string_literal: true
# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
create_table :active_storage_blobs do |t|
t.string :key, null: false
t.string :filename, null: false
t.stri... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191012214056_create_purchases.rb | Ruby | mit | 191 | main | 239 | # frozen_string_literal: true
class CreatePurchases < ActiveRecord::Migration[6.0]
def change
create_table :purchases do |t|
t.float :value
t.references :supplier, foreign_key: true
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240209123513_create_features.rb | Ruby | mit | 191 | main | 242 | class CreateFeatures < ActiveRecord::Migration[7.0]
def change
create_table :features do |t|
t.string :name, null: false, unique: true
t.boolean :is_enabled, null: false, default: false
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240918190421_add_prices_to_production_products.rb | Ruby | mit | 191 | main | 259 | class AddPricesToProductionProducts < ActiveRecord::Migration[7.0]
def change
add_column :production_products, :unit_price, :decimal, precision: 10, scale: 2
add_column :production_products, :total_price, :decimal, precision: 10, scale: 2
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191012214053_create_sale_products.rb | Ruby | mit | 191 | main | 315 | # frozen_string_literal: true
class CreateSaleProducts < ActiveRecord::Migration[6.0]
def change
create_table :sale_products do |t|
t.integer :quantity
t.float :value
t.references :product, foreign_key: true
t.references :sale, foreign_key: true
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20231109124922_add_index_bling_order_id_to_bling_order_item.rb | Ruby | mit | 191 | main | 476 | # frozen_string_literal: true
# To deal with upinsert_all unique_by: :column_name options
# To not raise exception "upsert no unique index found"
# Check https://github.com/jesjos/active_record_upsert/issues/101
# And https://stackoverflow.com/questions/59472362/rails-upsert-no-unique-index-found
# discussions.
class ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240903193442_remove_columns_from_production.rb | Ruby | mit | 191 | main | 263 | class RemoveColumnsFromProduction < ActiveRecord::Migration[7.0]
def change
remove_column :productions, :delivery_date, :datetime
remove_column :productions, :deliver_date, :datetime
remove_column :productions, :pieces_delivered, :integer
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20200907023648_create_simplo_items.rb | Ruby | mit | 191 | main | 320 | # frozen_string_literal: true
class CreateSimploItems < ActiveRecord::Migration[6.0]
def change
create_table :simplo_items do |t|
t.string :sku
t.integer :quantity
t.references :simplo_order, foreign_key: true
t.references :product, foreign_key: true
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20200907023628_create_simplo_orders.rb | Ruby | mit | 191 | main | 286 | # frozen_string_literal: true
class CreateSimploOrders < ActiveRecord::Migration[6.0]
def change
create_table :simplo_orders do |t|
t.string :client_name
t.string :order_id
t.string :order_status
t.string :order_date
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20241023183743_create_bling_module_situations.rb | Ruby | mit | 191 | main | 403 | class CreateBlingModuleSituations < ActiveRecord::Migration[7.0]
def change
create_table :bling_module_situations do |t|
t.integer :situation_id, null: false
t.string :name, null: false
t.integer :inherited_id
t.string :color
t.integer :module_id, null: false
t.timestamps
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20210104233115_add_full_name_to_users.rb | Ruby | mit | 191 | main | 243 | # frozen_string_literal: true
class AddFullNameToUsers < ActiveRecord::Migration[6.0]
def change
add_column :users, :first_name, :string
add_column :users, :last_name, :string
add_column :users, :company_name, :string
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20210104184746_create_accounts.rb | Ruby | mit | 191 | main | 254 | # frozen_string_literal: true
class CreateAccounts < ActiveRecord::Migration[6.0]
def change
create_table :accounts do |t|
t.string :company_name
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20201110130051_create_simplo_item_sales.rb | Ruby | mit | 191 | main | 419 | # frozen_string_literal: true
class CreateSimploItemSales < ActiveRecord::Migration[6.0]
def change
create_table :simplo_item_sales do |t|
t.string :produto_id
t.string :sku
t.string :nome_produto
t.integer :quantidade
t.float :valor_unitario
t.float :valor_total
t.float... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20220501163827_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb | Ruby | mit | 191 | main | 267 | # frozen_string_literal: true
# This migration comes from active_storage (originally 20211119233751)
class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
def change
change_column_null(:active_storage_blobs, :checksum, true)
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240619153852_create_good_job_process_lock_indexes.rb | Ruby | mit | 191 | main | 1,943 | # frozen_string_literal: true
class CreateGoodJobProcessLockIndexes < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked)
add_index ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20231005211754_create_revenue_estimations.rb | Ruby | mit | 191 | main | 260 | class CreateRevenueEstimations < ActiveRecord::Migration[7.0]
def change
create_table :revenue_estimations do |t|
t.decimal :average_ticket
t.integer :quantity
t.decimal :revenue
t.date :date
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191012185508_create_products.rb | Ruby | mit | 191 | main | 360 | # frozen_string_literal: true
class CreateProducts < ActiveRecord::Migration[6.0]
def change
create_table :products do |t|
t.string :name
t.float :price
t.string :bar_code
t.string :image_url
t.boolean :highlight
t.references :category, foreign_key: true
t.boolean :activ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20220512221958_create_stores.rb | Ruby | mit | 191 | main | 286 | class CreateStores < ActiveRecord::Migration[7.0]
def change
create_table :stores do |t|
t.string :name
t.string :address
t.string :phone
t.string :email
t.integer :account_id
t.timestamps
end
add_index :stores, :account_id
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240918180211_add_material_costs_to_productions.rb | Ruby | mit | 191 | main | 245 | class AddMaterialCostsToProductions < ActiveRecord::Migration[7.0]
def change
add_column :productions, :notions_cost, :decimal, precision: 10, scale: 2
add_column :productions, :fabric_cost, :decimal, precision: 10, scale: 2
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20231114163537_change_json_to_jsonb_in_shein_orders.rb | Ruby | mit | 191 | main | 294 | class ChangeJsonToJsonbInSheinOrders < ActiveRecord::Migration[7.0]
def up
# Change the column type from JSON to JSONB
change_column :shein_orders, :data, :jsonb
end
def down
# Revert the column type from JSONB to JSON
change_column :shein_orders, :data, :json
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240117192518_create_good_job_labels_index.rb | Ruby | mit | 191 | main | 645 | # frozen_string_literal: true
class CreateGoodJobLabelsIndex < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_labels)
add_index :good_jobs, :labels, using: :gin, where: ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240209123708_create_account_features.rb | Ruby | mit | 191 | main | 305 | class CreateAccountFeatures < ActiveRecord::Migration[7.0]
def change
create_table :account_features do |t|
t.bigint :account_id, null: false, unique: true
t.integer :feature_id, null: false, unique: true
t.boolean :is_enabled, default: false
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20210104210247_add_account_to_sale_products.rb | Ruby | mit | 191 | main | 211 | # frozen_string_literal: true
class AddAccountToSaleProducts < ActiveRecord::Migration[6.0]
def change
add_column :sale_products, :account_id, :integer
add_index :sale_products, :account_id
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240619153851_create_good_job_process_lock_ids.rb | Ruby | mit | 191 | main | 578 | # frozen_string_literal: true
class CreateGoodJobProcessLockIds < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_jobs, :locke... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240910182512_create_balances.rb | Ruby | mit | 191 | main | 392 | class CreateBalances < ActiveRecord::Migration[7.0]
def change
create_table :balances do |t|
t.bigint :deposit_id, null: false
t.integer :physical_balance, null: false
t.integer :virtual_balance, null: false
t.references :stock, null: false, foreign_key: true
t.timestamps
end
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240910152052_create_warehouses.rb | Ruby | mit | 191 | main | 516 | class CreateWarehouses < ActiveRecord::Migration[7.0]
def change
create_table :warehouses do |t|
t.string :bling_id, null: false
t.string :description, null: false
t.integer :status, null: false, default: 1
t.boolean :is_default, null: false, default: false
t.boolean :ignore_balance,... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240103204520_create_items.rb | Ruby | mit | 191 | main | 426 | class CreateItems < ActiveRecord::Migration[7.0]
def change
create_table :items do |t|
t.string :sku
t.integer :unity
t.integer :quantity
t.decimal :discount
t.decimal :value
t.decimal :ipi_tax
t.string :description
t.string :long_description
t.bigint :product... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240828195207_add_missing_fields_to_productions.rb | Ruby | mit | 191 | main | 1,167 | class AddMissingFieldsToProductions < ActiveRecord::Migration[7.0]
def change
change_table :productions, bulk: true do |t|
t.column :number, :integer, if_not_exists: true
t.column :delivery_date, :date, if_not_exists: true
t.column :pieces_delivered, :integer, if_not_exists: true
t.column ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240912132936_add_fields_to_production_products.rb | Ruby | mit | 191 | main | 290 | class AddFieldsToProductionProducts < ActiveRecord::Migration[7.0]
def change
add_column :production_products, :dirty, :integer, default: 0
add_column :production_products, :error, :integer, default: 0
add_column :production_products, :discard, :integer, default: 0
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20220501163826_create_active_storage_variant_records.active_storage.rb | Ruby | mit | 191 | main | 1,059 | # frozen_string_literal: true
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
# Use Active Record's configured type for primary key
create_table :active_storage_variant_records, id: primary_key_type, if_n... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240901150326_add_pieces_delivered_and_pieces_missing_to_production_products.rb | Ruby | mit | 191 | main | 243 | class AddPiecesDeliveredAndPiecesMissingToProductionProducts < ActiveRecord::Migration[7.0]
def change
add_column :production_products, :pieces_delivered, :integer
add_column :production_products, :pieces_missing, :integer
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240412194910_create_localizations.rb | Ruby | mit | 191 | main | 432 | class CreateLocalizations < ActiveRecord::Migration[7.0]
def change
create_table :localizations do |t|
t.string :name
t.string :address
t.string :number
t.string :complement
t.string :city
t.string :state
t.string :zip_code
t.string :neighborhood
t.string :cou... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20231030151911_create_finance_data.rb | Ruby | mit | 191 | main | 242 | class CreateFinanceData < ActiveRecord::Migration[7.0]
def change
create_table :finance_data do |t|
t.date :date
t.decimal :income
t.decimal :expense
t.decimal :fixed_amount
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240925135927_create_payments.rb | Ruby | mit | 191 | main | 251 | class CreatePayments < ActiveRecord::Migration[7.0]
def change
create_table :payments do |t|
t.decimal :amount
t.date :payment_date
t.references :production, null: false, foreign_key: true
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191012214051_create_sales.rb | Ruby | mit | 191 | main | 333 | # frozen_string_literal: true
class CreateSales < ActiveRecord::Migration[6.0]
def change
create_table :sales do |t|
t.float :value
t.float :discount
t.float :percentage
t.boolean :online
t.boolean :disclosure
t.references :customer, foreign_key: true
t.timestamps
e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.