compound icon indicating copy to clipboard operation
compound copied to clipboard

"compound generate crud" creating malformed code in schema.js

Open seansbox opened this issue 13 years ago • 3 comments

Executing:

compound generate crud user email password verification verified:boolean --tpl jade

Modifies db/schema.js like so:

User = describe 'User', ->
    property('email', String);
    property('password', String);
    property('verification', String);
    property('verified', Boolean);
    set 'restPath', pathTo.users

Seems like a mix of coffeescript and javascript. This followup command:

compound db migrate

Returns this:

undefined:25
User = describe 'User', ->
                ^^^^^^
SyntaxError: Unexpected string
    at Object.Function (unknown source)
    at loadSchema (X:\repos\temp2\node_modules\jugglingdb\lib\railway.js:92:18)
    at init (X:\repos\temp2\node_modules\jugglingdb\lib\railway.js:54:9)
    at Object.exports.init (X:\repos\temp2\node_modules\jugglingdb\index.js:24:15)
    at X:\repos\temp2\node_modules\compound\lib\server\extensions.js:27:23
    at Array.forEach (native)
    at init (X:\repos\temp2\node_modules\compound\lib\server\extensions.js:25:18)
    at CompoundServer.module.exports [as extensions] (X:\repos\temp2\node_modules\compound\lib\server\extensions
.js:18:9)
    at CompoundServer.initCompound (X:\repos\temp2\node_modules\compound\lib\compound.js:107:14)
    at CompoundServer.init (X:\repos\temp2\node_modules\compound\lib\server\compound.js:47:29)
    at X:\repos\temp2\node_modules\compound\lib\compound.js:57:22
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

seansbox avatar Mar 06 '13 21:03 seansbox

It was fixed in latest build (11 or 12). What's your version?

On Thursday, March 7, 2013, seansbox wrote:

Executing:

compound generate crud user email password verification verified:boolean --tpl jade

Modifies db/schema.js like so:

User = describe 'User', -> property('email', String); property('password', String); property('verification', String); property('verified', Boolean); set 'restPath', pathTo.users

Seems like a mix of coffeescript and javascript. This followup command:

compound db migrate

Returns this:

undefined:25 User = describe 'User', -> ^^^^^^ SyntaxError: Unexpected string at Object.Function (unknown source) at loadSchema (X:\repos\temp2\node_modules\jugglingdb\lib\railway.js:92:18) at init (X:\repos\temp2\node_modules\jugglingdb\lib\railway.js:54:9) at Object.exports.init (X:\repos\temp2\node_modules\jugglingdb\index.js:24:15) at X:\repos\temp2\node_modules\compound\lib\server\extensions.js:27:23 at Array.forEach (native) at init (X:\repos\temp2\node_modules\compound\lib\server\extensions.js:25:18) at CompoundServer.module.exports [as extensions](X:repostemp2node_modulescompoundlibserverextensions .js:18:9) at CompoundServer.initCompound (X:\repos\temp2\node_modules\compound\lib\compound.js:107:14) at CompoundServer.init (X:\repos\temp2\node_modules\compound\lib\server\compound.js:47:29) at X:\repos\temp2\node_modules\compound\lib\compound.js:57:22 at process.startup.processNextTick.process._tickCallback (node.js:244:9)

— Reply to this email directly or view it on GitHubhttps://github.com/1602/compound/issues/435 .

anatoliychakkaev avatar Mar 07 '13 05:03 anatoliychakkaev

Confirmed. Fix published in 12

1602 avatar Mar 07 '13 07:03 1602

This needs to be fixed in the node package co-generators/assets/db/schema_model.js too.

dineshgadge avatar Nov 29 '17 08:11 dineshgadge