2 apps with 1 one database


#1

Hi;

I am developping a web app and I’ve wrote some admin code (parsing web
site, sending massmail etc…) which don’t need to be deployed.
So I would like this code to be part of a second developement app.

But there’s a probleme regarding the schema_migrations table. it must
be unique.

How can I solve this problem?

Thanks
JF


#2

Hi jef,

jef wrote:

I am developping a web app and I’ve wrote some admin
code (parsing web site, sending massmail etc…) which don’t
need to be deployed. So I would like this code to be part of
a second developement app.

Interesting. What leads you to want to separate the admin functionality
into a completely separate app?

But there’s a probleme regarding the schema_migrations table.
it must be unique.

How can I solve this problem?

The easiest way I can think of would be to simply run all your
migrations
from one of the apps. As long as you never run any migrations from the
second app I can’t think of any way you’d run into conflicts. Doesn’t
mean
you won’t. Just that I can’t think of any off the top of my head :wink:

HTH,
Bill


#3

Interesting. What leads you to want to separate the admin functionality
into a completely separate app?

I want my dev app to be equal to the production app to make
deployement easier.

The easiest way I can think of would be to simply run all your migrations
from one of the apps. As long as you never run any migrations from the
second app I can’t think of any way you’d run into conflicts. Doesn’t mean
you won’t. Just that I can’t think of any off the top of my head :wink:

I need to run migrations from the admin app.


#4

On the other hand, I don’t understand why not use role based
authorization to the admin area?


#5

On the other hand, I don’t understand why not use role based
authorization to the admin area?

Most of the code is used only once. Ex:
parse the foo.com web site and grab the email adresse.
Send email to some users (some who have a website, some who has been
born in july, some who have a dog, etc)

So I don’t want to deploy that code but I want to keep it in an
appropriate place.
That’s why I thougt about a second app using database of the main app.


#6

Like I said, it doesn’t matter which app you run your migrations from. Just
pick one.

My admin app will never be in production.
It’s just a place where I store one shot code (parsing website code,
etc …).


#7

Harold wrote:

On the other hand, I don’t understand why not use
role based authorization to the admin area?

Exactly.

OTOH…

I need to run migrations from the admin app.

Like I said, it doesn’t matter which app you run your migrations from.
Just
pick one.

HTH,
Bill


#8

Well, to me it sounds like your “admin app” is just a bunch of rake
tasks that do some bookkeeping for you. You seem to be solving a
problem that does not exist - again, what’s the problem with the admin
code living in the same app? Even if it makes it to production?

Be that as it may, if you insist in having two rails apps, I would
disable the db:migrate rake task on the admin app. Make it raise an
exception. Same with the migration generator.