difference between deploy a contract(e.g. truffle migrate) and new a Contract

Let's say now we have this:
import "./Contract.sol";
contract Factory {
address[] newContracts;

function createContract (bytes32 name) {
address newContract = new Contract(name);
contract Contract {
bytes32 public Name;

function Contract (bytes32 name) {
Name = name;

then we can deploy this two contracts like this:
var Factory = artifacts.require("./Factory.sol");
var Contract= artifacts.require("./Contract.sol")
module.exports = function(deployer){
deployer.deploy(Contract,['Contract 1"]);
then we deploy this two contracts by : truffle migrate
after that we can interact with the smart contract through web3js, for simplity, I just call:
var factory = contract(factory_artifacts);
inst.createContract('Contract 2", {from: web3.eth.accounts[0]});

1). what's the difference when I call "deployer.deploy(Contract,['Contract 1"]);" through truffle migrate and " inst.createContract('Contract 2", {from: web3.eth.accounts[0]});" through web3js
2). where does it store, I mean the bytecode I deployed and the "nstance" I created: 'Contract 1' and 'Contract 2', are they stored in the same place
3). instead of deployer.deploy(Contract,['Contract 1"]); how about if deployer.deploy(Contract); without calling the construction function, is it ok, if this is fine, then what's the difference again?

Sign In or Register to comment.