Code snippets for symfony 1.x

Navigation

Refine Tags

Snippets tagged "pgsql"

Use different schema with postgresql

How to use a different schema as "public" with postgresql/symfony? Please find below the solution I use

Todo in postgresql

-- Create user
CREATE ROLE appUser LOGIN ENCRYPTED PASSWORD '' NOINHERIT VALID UNTIL 'infinity';
 
-- Create schema
CREATE SCHEMA appSchema AUTHORIZATION appUser;
 
-- Change default search path of user
ALTER USER appUser SET search_path TO appSchema, public;
 

To do in symfony

Comments line 202 in symfony-1.2.8/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/sql/pgsql/PgsqlDDLBuilder.php

//$script .= "\nSET search_path TO public;";
 

Config databases.yml and propel.ini

dev:
  propel:
    param:
      classname:  DebugPDO
 
test:
  propel:
    param:
      classname:  DebugPDO
 
all:
  propel:
    class:        sfPropelDatabase
    param:
      classname:  PropelPDO
      dsn:        pgsql:host=localhost;dbname=mydb
      username:   appUser
      password:   test
      encoding:   utf8
      persistent: true
      pooling:    true
 
------------------------------------------
[propel.ini]
propel.targetPackage       = lib.model
propel.packageObjectModel  = true
propel.project             = sfTest
propel.database            = pgsql
propel.database.driver     = pgsql
propel.database.url        = pgsql:host=localhost;dbname=mydb
propel.database.creole.url = ${propel.database.url}
propel.database.user       = appUser
propel.database.password   = test
propel.database.encoding   = utf8
 
propel.addVendorInfo       = true
propel.addGenericAccessors = true
propel.addGenericMutators  = true
propel.addTimeStamp        = true
propel.addValidators       = false
 
propel.useDateTimeClass       = true
propel.defaultTimeStampFormat = Y-m-d H:i:s
propel.defaultTimeFormat      = H:i:s
propel.defaultDateFormat      = Y-m-d
 
propel.schema.validate        = false
propel.samePhpName            = false
propel.disableIdentifierQuoting     = false
propel.emulateForeignKeyConstraints = true
 
; directories
propel.home                    = .
propel.output.dir              = /exp/www/sfTest
propel.schema.dir              = ${propel.output.dir}/config
propel.conf.dir                = ${propel.output.dir}/config
propel.phpconf.dir             = ${propel.output.dir}/config
propel.sql.dir                 = ${propel.output.dir}/data/sql
propel.runtime.conf.file       = runtime-conf.xml
propel.php.dir                 = ${propel.output.dir}
propel.default.schema.basename = schema
propel.datadump.mapper.from    = *schema.xml
propel.datadump.mapper.to      = *data.xml
 
; builder settings
propel.builder.peer.class              = plugins.sfPropelPlugin.lib.builder.SfPeerBuilder
propel.builder.object.class            = plugins.sfPropelPlugin.lib.builder.SfObjectBuilder
propel.builder.objectstub.class        = plugins.sfPropelPlugin.lib.builder.SfExtensionObjectBuilder
propel.builder.peerstub.class          = plugins.sfPropelPlugin.lib.builder.SfExtensionPeerBuilder
propel.builder.objectmultiextend.class = plugins.sfPropelPlugin.lib.builder.SfMultiExtendObjectBuilder
propel.builder.mapbuilder.class        = plugins.sfPropelPlugin.lib.builder.SfMapBuilderBuilder
 
propel.builder.addIncludes  = false
propel.builder.addComments  = true
propel.builder.addBehaviors = true
 
by Giuseppe Damiani on 2009-09-09, tagged pgsql  postgresql  schema