{"record":{"id":"5ff7dbe5721cb6e7","repo":"ankane/pgsync","slug":"cannot-use-preserve-with-schema-first-or-sch","errorCode":null,"errorMessage":"Cannot use --preserve with --schema-first or --schema-only","messagePattern":"Cannot use --preserve with --schema-first or --schema-only","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/pgsync/schema_sync.rb","lineNumber":17,"sourceCode":"module PgSync\n  class SchemaSync\n    include Utils\n\n    attr_reader :args, :opts\n\n    def initialize(source:, destination:, tasks:, args:, opts:)\n      @source = source\n      @destination = destination\n      @tasks = tasks\n      @args = args\n      @opts = opts\n    end\n\n    def perform\n      if opts[:preserve]\n        raise Error, \"Cannot use --preserve with --schema-first or --schema-only\"\n      end\n\n      # generate commands before starting spinner\n      # for better error output if pg_restore not found\n      dump_command = dump_command()\n      restore_command = restore_command()\n\n      show_spinner = output.tty? && !opts[:debug]\n\n      if show_spinner\n        spinner = TTY::Spinner.new(\":spinner Syncing schema\", format: :dots)\n        spinner.auto_spin\n      end\n\n      create_schemas if specify_tables?\n\n      # if spinner, capture lines to show on error\n      lines = []","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/ankane/pgsync/blob/57bdddf5db506d329b51cb3376379dc3a2559010/lib/pgsync/schema_sync.rb#L1-L35","documentation":"Error \"Cannot use --preserve with --schema-first or --schema-only\" thrown in ankane/pgsync.","triggerScenarios":"Thrown at lib/pgsync/schema_sync.rb:17 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57bdddf5db506d329b51cb3376379dc3a2559010","analyzedAt":"2026-08-23T11:18:48.887Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}